﻿using System.Collections.Generic;
using System.Linq;
using KLS.PPDS.Core.Entity;
using KLS.PPDS.Data.Database.Repository.RepositoryInterfaces;

namespace KLS.PPDS.Data.Database.Repository.EntityRepository
{
    public class ContentImageRepository : LinqRepository<ContentImage>, IContentImageRepository
    {


        public List<ContentImage> GetAllContentImage()
        {
            return FindAll().ToList();

        }

        public ContentImage GetContentImageById(int contentImageId)
        {
            return FindOne(contentImageId);

        }

        public List<ContentImage> GetContentImageByContentId(int contentId)
        {

            return FindAll().Where(x => x.ContentId.Equals(contentId)).OrderBy(c => c.Id).ToList();
        }

        public ContentImage GetContentImageByIdAndDiskFileName(int ContentId, string DiskFileName) 
        {
            return FindAll().Where(x => x.ContentId.Equals(ContentId) && x.DiskFileName.Equals(DiskFileName)).FirstOrDefault();
        }

        
    }
}
